import { defineStore } from 'pinia'

const userStore = defineStore('user', {
    state: () => ({
        info: {
            userId: 0,
            accessToken: "",
            refreshToken: ""
        }
    }),
    getters: {},
    actions: {
        logout(params) {
            this.info = {}
        },
        saveUserInfo(userId, accessToken, refreshToken){
            this.info = {
                userId: userId,
                accessToken: accessToken,
                refreshToken: refreshToken
            }
        }
    },
    persist: true,
})

export default userStore
